package com.twu.biblioteca;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class BibliotecaApp {

    public static void main(String[] args) {

        IOManager ioManager = new IOManager(System.out, new BufferedReader(new InputStreamReader(System.in)));

        List<LibraryBook> bookList = new ArrayList<LibraryBook>();
        bookList.add(new LibraryBook("The Wizard of Oz", true));
        Library library = new Library(bookList, ioManager);

        Map<String, LibraryAction> options = options(ioManager, library);

        Menu menu = new Menu(options, ioManager);
        new Biblioteca(ioManager, options, menu).run();

    }

    private static Map<String, LibraryAction> options(IOManager ioManager, Library library) {
        Map<String, LibraryAction> options = new HashMap<String, LibraryAction>();

        options.put("1", new BookLister(library, ioManager));
        options.put("2", new CheckOuter(library, ioManager));
        options.put("3", new BookReturner(library, ioManager));
        return options;
    }
}
